<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ZH-cn">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>登录界面</title>
  <link rel="stylesheet" href="kit_admin/plugins/layui/css/layui.css">
  <link rel="stylesheet" href="kit_admin/src/css/login.css">
</head>

<body>
  <div class="kit-login">
    <div class="kit-login-bg"></div>
    <div class="kit-login-wapper">
      <h2 class="kit-login-slogan">欢迎使用 <br> 科华协同平台后台登录</h2>
      <div class="kit-login-form">
        <h4 class="kit-login-title">登录</h4>
        <form class="layui-form" >
          <div class="kit-login-row">
            <div class="kit-login-col">
              <i class="layui-icon">&#xe612;</i>
              <span class="kit-login-input">
                <input type="text" autocomplete="off" name="staffNo" lay-verify="required" placeholder="工号"  value="1110"/>
              </span>
            </div>
            <div class="kit-login-col"></div>
          </div>
          <div class="kit-login-row">
            <div class="kit-login-col">
              <i class="layui-icon">&#xe64c;</i>
              <span class="kit-login-input">
                <input type="password" autocomplete="off" name="password" lay-verify="required" placeholder="密码" value="123456"/>
              </span>
            </div>
            <div class="kit-login-col"></div>
          </div>
          <div class="kit-login-row">
            <div class="kit-login-col">
              <input type="checkbox" name="rememberMe" title="记住帐号" lay-skin="primary">
            </div>
          </div>
          <div class="kit-login-row">
            <button class="layui-btn kit-login-btn" lay-submit="submit" lay-filter="login_hash">登录</button>
          </div>
          <div class="kit-login-row" style="margin-bottom:0;">
            <a href="javascript:;" style="color: rgb(153, 153, 153); text-decoration: none; font-size: 13px;" id="forgot">忘记密码</a>
          </div>
        </form>
      </div>
    </div>
  </div>

  <script src="kit_admin/plugins/polyfill.min.js"></script>
  <script src="kit_admin/plugins/layui/layui.js"></script>
  <script>
    layui.use(['layer', 'form'], function() {
      var form = layui.form,
        $ = layui.jquery;

      $('#forgot').on('click', function() {
        layer.msg('请联系管理员.');
      });
      //监听提交
      form.on('submit(login_hash)', function(formData) {
    	  	//method="post" action="loginController.do?doLogin"
        //layer.msg(JSON.stringify(data.field));
    	  	$.ajax({
    	  		 url: "loginController.do?doLogin",
             type: "post",
             data: formData.field,
             dataType: "json",
             success: function(data) {
	            	 if(1 != data.code){
	             		layer.msg(data.message);
	             		return ;
	             }
	            	 setTimeout(function(){
	                     location.href='loginController.do?home';
	             },1000);
             },
             error: function(XMLHttpRequest, textStatus, errorThrown) {
                 /* alert(XMLHttpRequest.status);
                 alert(XMLHttpRequest.readyState);
                 alert(textStatus); */
                 layer.msg("网络问题，请联系管理员");
             }
    	  	});
        return false;
      });
    });
  </script>
</body>

</html>